package com.wang.web3.adapter;

import android.content.Context;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import java.util.List;


/**
 * @author Mr.Wang
 * @version 1.0
 * @time 2017/4/7
 * @describe
 */

public class ViewPagerAdapter extends FragmentPagerAdapter {

    private List<String> tabList;
    private Context context;
    private List<Fragment> fragments;

    public ViewPagerAdapter(FragmentManager fm, Context context, List<Fragment> fragments, List<String> tabList) {
        super(fm);
        this.context = context;
        this.fragments = fragments;
        this.tabList = tabList;
    }

    @Override
    public Fragment getItem(int position) {
        return fragments.get(position);
    }

    @Override
    public int getCount() {
        return fragments.size();
    }

    @Override
    public CharSequence getPageTitle(int position) {
        return tabList.get(position);
    }
}
